
# 导入库
import pandas as pd
from keras.layers import Dense
from keras.models import Sequential
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.neural_network import MLPClassifier
from sklearn.tree import DecisionTreeClassifier

# 加载数据集
data = pd.read_csv('order_train1_processed.csv')
X = data.iloc[:, :-1]
y = data.iloc[:, -1]

# 划分数据集为训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)

# 决策树算法
dtc = DecisionTreeClassifier()
dtc.fit(X_train, y_train)
y_pred_dtc = dtc.predict(X_test)
print('决策树算法:', accuracy_score(y_test, y_pred_dtc))

# 贝叶斯算法
gnb = GaussianNB()
gnb.fit(X_train, y_train)
y_pred_gnb = gnb.predict(X_test)
print('贝叶斯算法:', accuracy_score(y_test, y_pred_gnb))

# 神经网络算法
mlp = MLPClassifier(hidden_layer_sizes=(10,), max_iter=1000)
mlp.fit(X_train, y_train)
y_pred_mlp = mlp.predict(X_test)
print('神经网络算法:', accuracy_score(y_test, y_pred_mlp))


